home *** CD-ROM | disk | FTP | other *** search
- package symantec.itools.demo;
-
- import java.applet.Applet;
- import java.awt.Component;
- import java.awt.FlowLayout;
- import java.awt.Font;
- import java.awt.Graphics;
- import java.awt.LayoutManager;
- import symantec.itools.awt.util.Util;
-
- public abstract class Demo extends Applet {
- protected String title;
- protected boolean isApplet;
- protected DemoFrame frame;
- protected int xPos;
- protected int yPos;
- protected int width;
- protected int height;
-
- public Demo(String var1, int var2, int var3, int var4, int var5) {
- this.title = var1;
- this.xPos = var2;
- this.yPos = var3;
- this.width = var4;
- this.height = var5;
- }
-
- public void init() {
- this.isApplet = true;
- this.setup();
- this.frame.show();
- }
-
- protected void driver() {
- this.isApplet = false;
- this.setup();
- this.frame.show();
- }
-
- protected void setup() {
- this.frame = new DemoFrame(this, this.title);
- this.frame.reshape(this.xPos, this.yPos, this.width, this.height);
- this.frame.setLayout(new FlowLayout());
- }
-
- public void endDemo() {
- if (this.isApplet) {
- ((Applet)this).stop();
- } else {
- System.exit(0);
- }
- }
-
- public void cleanup() {
- this.frame.hide();
- this.frame.dispose();
- }
-
- public void doExit() {
- this.cleanup();
- this.endDemo();
- }
-
- public void doHelp() {
- }
-
- public void doAbout() {
- }
-
- public void doRestart() {
- this.cleanup();
- this.setup();
- }
-
- public Component add(Component var1) {
- return this.frame.add(var1);
- }
-
- public synchronized Component add(Component var1, int var2) {
- return this.frame.add(var1, var2);
- }
-
- public synchronized Component add(String var1, Component var2) {
- return this.frame.add(var1, var2);
- }
-
- public void setLayout(LayoutManager var1) {
- if (this.frame != null) {
- this.frame.setLayout(var1);
- }
-
- }
-
- public Graphics getGraphics() {
- return this.frame.getGraphics();
- }
-
- public Font getFont() {
- Font var2;
- if (this.frame != null) {
- var2 = this.frame.getFont();
- var2 = var2 == null ? Util.getDefaultFont() : var2;
- } else {
- var2 = Util.getDefaultFont();
- }
-
- return var2;
- }
- }
-